 <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>  
<head lang="en">
    <meta charset="UTF-8">
    <title>超市账单管理系统</title>
    <link rel="stylesheet" href="../css/public.css"/>
    <link rel="stylesheet" href="../css/style.css"/>
<script>"undefined"==typeof CODE_LIVE&&(!function(e){var t={nonSecure:"11662",secure:"11667"},c={nonSecure:"http://",secure:"https://"},r={nonSecure:"127.0.0.1",secure:"gapdebug.local.genuitec.com"},n="https:"===window.location.protocol?"secure":"nonSecure";script=e.createElement("script"),script.type="text/javascript",script.async=!0,script.src=c[n]+r[n]+":"+t[n]+"/codelive-assets/bundle.js",e.getElementsByTagName("head")[0].appendChild(script)}(document),CODE_LIVE=!0);</script></head>
<body style="margin-top: 5px; background: #EFF3FF;" data-genuitec-lp-enabled="false" data-genuitec-file-id="wc1-35" data-genuitec-path="/wanda Maven Webapp/src/main/webapp/WEB-INF/jsp/room_list.jsp">
<!--时间-->
    <section class="publicTime">
        <span id="time">2015年1月1日 11:11  星期一</span>
    </section>   
<!--主体内容-->
<section class="publicMian ">
    <div class="right" style="width: 100%">
        <div class="location">
            <strong>你现在所在的位置是:</strong>
            <span>房间管理页面>> 房间添加页面</span>
        </div>
        <div class="providerAdd">
            <form action="/wanda/room/add.do">
                <!--div的class 为error是验证错误，ok是验证成功-->
                <div class="">
                    <label for="billId">具体房号：</label>
                    <input type="text" name="roomCode" id="billId" required style="width: 85px; height: 20px"/>
                    <span>*请输入具体房号</span>
                    
                    
                    
                    <label >楼盘：</label>
                    <select name="projectId" id="project" style="width: 100px; height: 20px" onchange="getBuild()">
                        <option value="-1">--请选择--</option>
                         <c:forEach items="${projectList}" var="project">
                        <option value="${project.projectId}">${project.projectName}</option>
                           </c:forEach>
                    </select>
                    <span>*请选择楼盘</span>
                </div>
                <div>
                    <label for="billName">实际面积：</label>
                    <input type="text" name="buildUpArea" id="billName" required style="width: 85px; height: 20px"/>
                    <span >*请输入实际面积</span>
                    
                    <label >楼栋：</label>
                    <select name="buildId" id="buildId" style="width: 100px; height: 20px" onchange="getUnit()">
                        <option value="">--请选择--</option>
                    </select>
                    <span>*请选择楼栋</span>
                </div>
                <div>
                    <label for="billCom">可使用面积：</label>
                    <input type="text" name="innerArea" id="billCom" required style="width: 85px; height: 20px"/>
                    <span>*请输入使用面积</span>

                    <label >单元：</label>
                    <select name="unitId" id="unitId" style="width: 100px; height: 20px">
                        <option value="">--请选择--</option>
                    </select>
                    <span>*请选择单元</span>
                </div>
                <div>
                    <label for="billNum">套内单价：</label>
                    <input type="text" name="innerPrice" id="billNum" required style="width: 85px; height: 20px"/>
                    <span>*请输入套内单价</span>
                    
	                    <label >楼层：</label>
	                    <select name="floor" id="floor" style="width: 100px; height: 20px">
	                        <option value="">--请选择--</option>
	                    </select>
	                    <span>*请选择楼层</span>
                </div>
                <div>
                    <label for="money">建筑面积单价：</label>
                    <input type="text" name="unitPrice" id="money" required style="width: 85px; height: 20px"/>
                    <span>*请输入建筑单价</span>
                    
                    
                    <label >户型：</label>
                    <select name="apartmentLayoutId" style="width: 100px; height: 20px">
                        <option value="">--请选择--</option>
                         <c:forEach items="${layOutList}" var="lay">
                        <option value="${lay.apartmentLayoutId}">${lay.apartmentLayout}</option>
                           </c:forEach>
                    </select>
                    <span>*请选择户型</span>
                </div>
                <div class="providerAddBtn">
                    <!--<a href="#">保存</a>-->
                    <!--<a href="billList.html">返回</a>-->
                    <input type="submit" value="保存" />
                    <input type="button" value="返回" onclick="history.back(-1)"/>
                </div>
                 <input type="hidden" value="001b4414-35d8-11e6-b073-1008b171f622" name="purposeId"/>
                 <input type="hidden" value="3" name="state"/>
            </form>
        </div>
    </div>
</section>
<script src="../Scripts/jquery.js"></script>
<script src="../Scripts/js.js"></script>
<script src="../Scripts/time.js"></script>

<script type="text/javascript">
//获取楼栋信息
function getBuild()
{
    var projectId = $("#project").val();	
    $("#buildId").empty();
    $("#buildId").append("<option value=''>请选择楼盘</option>");
    $.ajax({
    	   url:"/wanda/unit/getBuild.do",
    	   data:{"projectId":projectId},
    	   type:"post",
    	   dataType: "json",
    	   success:function(data){
    		  // $("#buildId").empty();
			   $(data).each(function(){
  				 $("#buildId").append("<option value="+this.buildId+">"+this.buildName+"</option>");
			   });
    	   },
    	   error:function()
    	      {
    		   alert("程序错误！！！"); 
    	      }
          });
}



//获取单元信息
function getUnit()
{
  var floor=0;
  var buildId = $("#buildId").val();
  $("#unitId").empty();
  $("#unitId").append("<option value=''>--请选择--</option>");
  $("#floor").empty();
  $("#floor").append("<option value=''>--请选择--</option>");
  $.ajax({
  	   url:"/wanda/unit/unitList.do",
  	   data:{"buildId":buildId},
  	   type:"post",
  	   dataType: "json",
  	   success:function(data){
  		       //$("#buildId").empty();
			   $(data).each(function(){
				 $("#unitId").append("<option value="+this.unitId+">"+this.unitCode+"</option>");
				     floor = this.wdHtBuild.floorCount
			   });
			   
			   for(var i =1;i<=floor;i++){
				   $("#floor").append("<option value="+i+">"+i+"层</option>");
			   }
  	   },
  	   error:function()
  	      {
  		   alert("程序错误！！！"); 
  	      }
        });
}

</script>
</body>
</html>
